#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ======================================================
# @File:      : generate_readme
# @Author     : forward_huan
# @Date       : 2024/10/26 20:25
# @Desc       :
# ======================================================
import os

from apidoc_md.main import create_md
from pack_tool import dirPath


def generate_readme():
    pkg_name = "net_utils"
    root_path = dirPath(os.path.abspath(__file__), level=1)
    save_dir = os.path.join(root_path, "out")
    create_md(root_path=root_path, pkg_path_data=pkg_name, save_dir=save_dir, is_clear=False)
    dest_path = os.path.join(root_path, pkg_name, "README.md")
    if os.path.exists(dest_path):
        os.remove(dest_path)
    os.rename(os.path.join(save_dir, "api.md"), dest_path)


if __name__ == '__main__':
    generate_readme()
